#!/usr/bin/env python

"""
tf_test_005_placeholders.py
Placeholder and feeding test example.
"""

__version__     = "1.0.0"
__author__      = "David Qiu"
__email__       = "david@davidqiu.com"
__website__     = "www.davidqiu.com"
__copyright__   = "Copyright (C) 2017, David Qiu. All rights reserved."


import tensorflow as tf
import numpy as np


if __name__ == '__main__':
  # definition
  input_1 = tf.placeholder(tf.float32, shape=(2, 3), name='input_1')
  input_2 = tf.placeholder(tf.float32, shape=(3, 4), name='input_2')
  output = tf.matmul(input_1, input_2, name='output')

  # execution
  with tf.Session() as sess:
    res = sess.run([input_1, input_2, output], feed_dict={
      input_1: np.random.sample((2, 3)),
      input_2: np.random.sample((3, 4))
    })

    print('input_1 = ')
    print(res[0])
    print('input_2 = ')
    print(res[1])
    print('output = ')
    print(res[2])


